/*     */ package com.lmpop.trade.ti_teambuy;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.dao.IbatisDbmImpl;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.FileIO;
/*     */ import com.lmpop.updateHtml.parseXml.Config;
/*     */ import com.lmpop.updateHtml.updateHtml.UpdateArticleHtml;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_teambuyInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */   FileIO io;
/*     */   Config conf;
/*     */   String rootpath;
/*     */   UpdateArticleHtml uah;
/*     */ 
/*     */   public Ti_teambuyInfo()
/*     */   {
/*  24 */     this.queryList = new QueryList();
/*  25 */     this.uah = new UpdateArticleHtml();
/*  26 */     this.io = new FileIO();
/*  27 */     this.conf = new Config();
/*  28 */     this.conf.init();
/*  29 */     this.rootpath = this.conf.getString("rootpath");
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  38 */     Ti_teambuy ti_teambuy = new Ti_teambuy();
/*  39 */     ti_teambuy.setInfo_id(map.getString("info_id"));
/*  40 */     ti_teambuy.setTitle(map.getString("title"));
/*  41 */     ti_teambuy.setType(map.getString("type"));
/*  42 */     ti_teambuy.setTeam_type(map.getString("team_type"));
/*  43 */     ti_teambuy.setPrice(map.getString("price"));
/*  44 */     ti_teambuy.setOld_price(map.getString("old_price"));
/*  45 */     ti_teambuy.setStart_date(map.getString("start_date"));
/*  46 */     ti_teambuy.setEnd_date(map.getString("end_date"));
/*  47 */     ti_teambuy.setTeam_num(map.getInt("team_num"));
/*  48 */     ti_teambuy.setLimit_num(map.getInt("limit_num"));
/*  49 */     ti_teambuy.setDown_num(map.getInt("down_num"));
/*  50 */     ti_teambuy.setTip(map.getString("tip"));
/*  51 */     ti_teambuy.setHighlight(map.getString("highlight"));
/*  52 */     ti_teambuy.setContent(map.getString("content"));
/*  53 */     ti_teambuy.setSeller(map.getString("seller"));
/*  54 */     ti_teambuy.setContact(map.getString("contact"));
/*  55 */     ti_teambuy.setBuy_limit(map.getInt("buy_limit"));
/*  56 */     ti_teambuy.setUser_id(map.getString("user_id"));
/*  57 */     ti_teambuy.setIn_date(map.getString("in_date"));
/*  58 */     ti_teambuy.setCur_store(map.getString("cur_store"));
/*  59 */     ti_teambuy.setLast_store("0");
/*  60 */     ti_teambuy.setVmoney(map.getString("vmoney"));
/*  61 */     ti_teambuy.setCat_attr(map.getString("cat_attr"));
/*  62 */     ti_teambuy.setIs_freeshipping(map.getString("is_freeshipping"));
/*  63 */     ti_teambuy.setCash_on_delivery(map.getString("cash_on_delivery"));
/*  64 */     ti_teambuy.setWeight(map.getString("weight"));
/*  65 */     ti_teambuy.setPrice_unit(map.getString("price_unit"));
/*  66 */     ti_teambuy.setTuihuo(map.getString("tuihuo"));
/*  67 */     ti_teambuy.setInput_price(map.getString("input_price"));
/*  68 */     ti_teambuy.setCust_id(map.getString("cust_id"));
/*  69 */     ti_teambuy.setInfo_state("0");
/*  70 */     String result_code = "0";
/*     */     try {
/*  72 */       insert(dbmMgr, ti_teambuy);
/*     */     } catch (Exception e) {
/*  74 */       e.printStackTrace();
/*  75 */       result_code = "1";
/*     */     }
/*  77 */     map.setString("result_code", result_code);
/*  78 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_teambuy ti_teambuy)
/*     */     throws ApplicationException
/*     */   {
/*  87 */     dbmMgr.update("insertTi_teambuy", ti_teambuy);
/*     */   }
/*     */ 
/*     */   public SysMap create_alterPage(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  92 */     this.uah.updateArticleByGoodsId("7212356b1j38456", map.getString("info_id"), "0", "1");
/*  93 */     return map;
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 102 */     String pkid_string = map.getString("pkid");
/* 103 */     String result_code = "0";
/*     */     try {
/* 105 */       if (!pkid_string.equals("")) {
/* 106 */         String[] pkStr = pkid_string.split("\\|");
/* 107 */         List list = null;
/* 108 */         String publish_date = "";
/* 109 */         for (int i = 0; i < pkStr.length; i++)
/* 110 */           if (!pkStr[i].equals("")) {
/* 111 */             list = this.queryList.getList("getTi_teambuyByPk", pkStr[i]);
/* 112 */             publish_date = ((Hashtable)list.get(0)).get("in_date").toString();
/* 113 */             publish_date = publish_date.substring(0, 10);
/* 114 */             delete(dbmMgr, pkStr[i]);
/* 115 */             FileIO.DelFile(this.rootpath + "/data/8diantuan/teambuy/" + publish_date + "/" + pkStr[i] + ".html");
/*     */           }
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/* 120 */       e.printStackTrace();
/* 121 */       result_code = "1";
/*     */     }
/* 123 */     map.setString("result_code", result_code);
/* 124 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 133 */     dbmMgr.update("deleteTi_teambuy", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 142 */     Ti_teambuy ti_teambuy = new Ti_teambuy();
/* 143 */     ti_teambuy.setInfo_id(map.getString("info_id"));
/* 144 */     ti_teambuy.setTitle(map.getString("title"));
/* 145 */     ti_teambuy.setType(map.getString("type"));
/* 146 */     ti_teambuy.setTeam_type(map.getString("team_type"));
/* 147 */     ti_teambuy.setPrice(map.getString("price"));
/* 148 */     ti_teambuy.setOld_price(map.getString("old_price"));
/* 149 */     ti_teambuy.setStart_date(map.getString("start_date"));
/* 150 */     ti_teambuy.setEnd_date(map.getString("end_date"));
/* 151 */     ti_teambuy.setTeam_num(map.getInt("team_num"));
/* 152 */     ti_teambuy.setLimit_num(map.getInt("limit_num"));
/* 153 */     ti_teambuy.setDown_num(map.getInt("down_num"));
/* 154 */     ti_teambuy.setTip(map.getString("tip"));
/* 155 */     ti_teambuy.setHighlight(map.getString("highlight"));
/* 156 */     ti_teambuy.setContent(map.getString("content"));
/* 157 */     ti_teambuy.setSeller(map.getString("seller"));
/* 158 */     ti_teambuy.setContact(map.getString("contact"));
/* 159 */     ti_teambuy.setBuy_limit(map.getInt("buy_limit"));
/* 160 */     ti_teambuy.setUser_id(map.getString("user_id"));
/* 161 */     ti_teambuy.setIn_date(map.getString("in_date"));
/* 162 */     ti_teambuy.setCur_store(map.getString("cur_store"));
/* 163 */     if ((map.getString("_cur_store") != null) && (!"".equals(map.getString("_cur_store"))))
/* 164 */       ti_teambuy.setLast_store(map.getString("_cur_store"));
/*     */     else
/* 166 */       ti_teambuy.setLast_store("0");
/* 167 */     ti_teambuy.setVmoney(map.getString("vmoney"));
/* 168 */     ti_teambuy.setCat_attr(map.getString("cat_attr"));
/* 169 */     ti_teambuy.setIs_freeshipping(map.getString("is_freeshipping"));
/* 170 */     ti_teambuy.setCash_on_delivery(map.getString("cash_on_delivery"));
/* 171 */     ti_teambuy.setWeight(map.getString("weight"));
/* 172 */     ti_teambuy.setPrice_unit(map.getString("price_unit"));
/* 173 */     ti_teambuy.setTuihuo(map.getString("tuihuo"));
/* 174 */     ti_teambuy.setInput_price(map.getString("input_price"));
/* 175 */     String result_code = "0";
/*     */     try {
/* 177 */       update(dbmMgr, ti_teambuy);
/*     */     }
/*     */     catch (Exception e) {
/* 180 */       e.printStackTrace();
/* 181 */       result_code = "1";
/*     */     }
/* 183 */     map.setString("result_code", result_code);
/* 184 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_teambuy ti_teambuy)
/*     */     throws ApplicationException
/*     */   {
/* 193 */     dbmMgr.update("updateTi_teambuy", ti_teambuy);
/*     */   }
/*     */ 
/*     */   public SysMap updateByIfId(DbmInterf dbmMgr, SysMap map) {
/* 197 */     Ti_teambuy ti_teambuy = new Ti_teambuy();
/* 198 */     ti_teambuy.setInfo_id(map.getString("info_id"));
/* 199 */     ti_teambuy.setTeam_num(map.getInt("team_num"));
/* 200 */     ti_teambuy.setCur_store(map.getString("cur_store"));
/* 201 */     ti_teambuy.setGroup_num(map.getString("group_num"));
/* 202 */     String result_code = "0";
/*     */     try {
/* 204 */       updateByIfId(dbmMgr, ti_teambuy);
/*     */     } catch (ApplicationException e) {
/* 206 */       e.printStackTrace();
/* 207 */       result_code = "1";
/*     */     }
/* 209 */     map.setString("result_code", result_code);
/* 210 */     return map;
/*     */   }
/*     */   public void updateByIfId(DbmInterf dbmMgr, Ti_teambuy ti_teambuy) throws ApplicationException {
/* 213 */     dbmMgr.update("updateTi_teambuyByIfId", ti_teambuy);
/*     */   }
/*     */ 
/*     */   public SysMap updatestate(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 218 */     Ti_teambuy ti_teambuy = new Ti_teambuy();
/* 219 */     ti_teambuy.setInfo_id(map.getString("info_id"));
/* 220 */     ti_teambuy.setInfo_state("1");
/*     */ 
/* 222 */     String result_code = "0";
/*     */     try {
/* 224 */       updatestate(dbmMgr, ti_teambuy);
/*     */     } catch (ApplicationException e) {
/* 226 */       e.printStackTrace();
/* 227 */       result_code = "1";
/*     */     }
/* 229 */     map.setString("result_code", result_code);
/* 230 */     return map;
/*     */   }
/*     */   public void updatestate(DbmInterf dbmMgr, Ti_teambuy ti_teambuy) throws ApplicationException {
/* 233 */     dbmMgr.update("updatestateTi_teambuyByIfId", ti_teambuy);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 243 */     Hashtable ti_teambuy = (Hashtable)obj;
/* 244 */     if (start == 0)
/* 245 */       start = 0;
/*     */     else {
/* 247 */       start = (start - 1) * limit;
/*     */     }
/* 249 */     ti_teambuy.put("start", Integer.valueOf(start));
/* 250 */     ti_teambuy.put("limit", Integer.valueOf(limit));
/* 251 */     return this.queryList.getList("getListByTi_teambuyPage", ti_teambuy);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 262 */     Hashtable ti_teambuy = (Hashtable)obj;
/* 263 */     List list = this.queryList.getList("getCountByObjTi_teambuy", ti_teambuy);
/* 264 */     int count = 0;
/* 265 */     if ((list != null) && (list.size() > 0)) {
/* 266 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 267 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 268 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 271 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk) {
/* 275 */     return this.queryList.getList("getTi_teambuyByPk", pk);
/*     */   }
/*     */ 
/*     */   public String getTitleByID(String pk) {
/* 279 */     List list = this.queryList.getList("getTi_teambuyByPk", pk);
/* 280 */     if ((list != null) && (list.size() > 0)) {
/* 281 */       return ((Hashtable)list.get(0)).get("title").toString();
/*     */     }
/* 283 */     return "";
/*     */   }
/*     */ 
/*     */   public void updateTeamNumByOrderNo(String order_no)
/*     */   {
/*     */     try {
/* 289 */       DbmInterf dbmMgr = new IbatisDbmImpl();
/* 290 */       List list = this.queryList.getList("getTeambuyByOrder", order_no);
/* 291 */       Map map = null;
/* 292 */       if ((list != null) && (list.size() > 0))
/* 293 */         for (int i = 0; i < list.size(); i++) {
/* 294 */           map = (Hashtable)list.get(i);
/* 295 */           dbmMgr.update("updateTeamNumByInfoId", map);
/*     */         }
/*     */     }
/*     */     catch (Exception e) {
/* 299 */       e.printStackTrace();
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] args) {
/* 304 */     new Ti_teambuyInfo().updateTeamNumByOrderNo("201107121701382");
/*     */   }
/*     */ 
/*     */   public List getTeambuyHotList() {
/* 308 */     List list = this.queryList.getList("getTeambuyHotList");
/* 309 */     return list;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_teambuy.Ti_teambuyInfo
 * JD-Core Version:    0.6.0
 */